<div id=update_form>
	<h1>Edit Profile</h1>
	<?php 
		$err_str = validation_errors('<p class="error">');
		if(strlen($err_str) > 0){ 
			echo $err_str;
		}
		if(isset($db_error)) echo '<p class="error">'.$db_error.'</p>';
		if(isset($user_data)):
			echo form_open('profile/save_changes');
	?>
	
	<fieldset>
		<legend>Personal Information</legend>
		
		<?php 
			echo form_label('First Name *', 'first_name');
			echo form_input('first_name', set_value('first_name', $user_data['first_name']), 'autocomplete="off"') . '<br />';
			
			echo form_label('Last Name *', 'last_name');
			echo form_input('last_name', set_value('last_name', $user_data['last_name']), 'autocomplete="off"') . '<br />';
			
			echo form_label('Email *', 'email');
			echo form_input('email', set_value('email', $user_data['email']), 'autocomplete="off"') . '<br />';
			
			echo form_label('Birthday yyyy-mm-dd', 'birthday');
			echo form_input('birthday', set_value('birthday', $user_data['birthday']), 'autocomplete="off"' ) . '<br />';
	
			echo form_label('Battle.Net URL', 'bnet');
			echo form_input('bnet', set_value('bnet', $user_data['bnet']), 'autocomplete="off"' ) . '<br />';
	 	
			echo form_label('Favourite Race', 'race');
			echo form_input('race', set_value('race', $user_data['race']), 'autocomplete="off"' ) . '<br />';
		?>
	</fieldset>
	
	<fieldset>
		<legend>Change Password (Optional)</legend>
		<?php 
			echo form_label('New Password');
			echo form_password('newpassword', '', 'autocomplete="off"');
			
			echo form_label('Confirm New Password');
			echo form_password('conf_newpassword', '', 'autocomplete="off"');
			
			echo form_label('Current Password *');
			echo form_password('password', '', 'autocomplete="off"');
		?>
	</fieldset>
	
	<?php 
		echo form_submit('submit', 'Save Changes');
		else:
	?>
	<br/><p class="error"> Error while loading user data </p>
	<?php endif; ?>
</div>